<template>
  <div style="background-color: #F5f7fa;">
    <div class="blueHeader">
      <div style="display: flex;margin-top: 46px;margin-left: 43px;">
        <span class="leftText">{{ projectForm.name }}</span>
        <div class="leftYellow">{{ projectForm.status }}</div>
      </div>
      <div style="display: flex;margin-top: 46px;color:#FFFFFF;margin-right: 40px;">
        <div class="topRight">项目编号：{{ projectForm.no }}</div>
        <div class="topRight">立项时间：{{ projectForm.establishTime }}</div>
        <div class="topRight">牵头部门：{{ projectForm.leadDeptName }}</div>
      </div>
    </div>
    <div style="background-color: #ffffff;width: 92%;margin: auto;margin-top: -143px;border-radius: 4px;">
      <el-tabs class="topTab" v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="基本信息" name="1" style="">
          <BaseInfo :projectInfo="projectForm" />
        </el-tab-pane>
        <el-tab-pane label="任务列表" name="2">
          <TaskList />
        </el-tab-pane>
        <!-- <el-tab-pane label="预算管理" name="3">预算管理</el-tab-pane>
        <el-tab-pane label="技术管理" name="4">技术管理</el-tab-pane>
        <el-tab-pane label="质量管理" name="5">质量管理</el-tab-pane>
        <el-tab-pane label="成果管理" name="6">成果管理</el-tab-pane> -->
      </el-tabs>
    </div>
  </div>
</template>
<script>
import BaseInfo from './baseInfo.vue'
import TaskList from './taskList.vue'
import { getProject } from "@/api/project/project";
export default {
  components: {
    BaseInfo,
    TaskList
  },
  data() {
    return {
      activeName: '1',
      projectForm: {
      },
      nowProjectId: ''
    };
  },
  mounted() {
    if (this.$route.query.activeName) {
      this.activeName = this.$route.query.activeName
    }
    getProject(this.$route.query.id).then(res => {
      this.nowProjectId = this.$route.query.id
      this.projectForm = res.data;
      this.projectForm.status = this.convertDict(this.projectForm.status, 'xmgl_status')
      this.projectForm.type = this.convertDict(this.projectForm.type, 'xmgl_project_type')
      this.projectForm.nature = this.convertDict(this.projectForm.nature, 'xmgl_project_nature')

    })
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    convertDict(dictValue, dictName) {
      const labelMap = {};
      let dict = this.$store.state.dictNew[dictName]
      dict.forEach(item => {
        labelMap[item.value] = item.label
      });
      let label = ''
      if (labelMap.hasOwnProperty(dictValue)) {
        label = labelMap[dictValue];
      }
      return label
    }
  }
};
</script>

<style scoped lang="scss">
.blueHeader {
  height: 225px;
  width: 98%;
  background-color: #47ACF4;
  margin: auto;
  border-radius: 2px;
  display: flex;
  justify-content: space-between;

  .leftText {
    font-family: PingFangSC-Medium;
    font-weight: 500;
    font-size: 18px;
    color: #FFFFFF;
    line-height: 24px;
  }

  .leftYellow {
    background: #E6A23C;
    border-radius: 100px;
    color: #FFFFFF;
    width: 63.56px;
    height: 26px;
    margin-left: 15px;
    text-align: center;
    line-height: 25px;
  }
}

.topTab {
  margin-top: 30px;
  margin-left: 20px;
  height: 726px;
}

.topRight {
  height: 24px;
  font-family: PingFangSC-Regular;
  font-weight: 400;
  font-size: 14px;
  line-height: 24px;
  margin-left: 20px;
}
</style>
<style>
.el-tabs__item {
  font-family: PingFangSC-Regular;
  font-weight: 400;
  font-size: 14px;
  color: #909399;
  text-align: center;
  line-height: 50px;
  height: 50px
}

.el-tabs__item.is-active {
  color: #47ACF4;
  font-weight: bold;
}
</style>
